package com.enthusiasm.frame;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

import com.enthusiasm.constants.Constants;
import com.young.R;

public class ModeAdapter extends BaseAdapter{
	private Context context;
	
	public ModeAdapter(Context context) {
		this.context = context;
	}
	
	private Integer[] mImageIds = { //picture source 
			R.drawable.p0,
			R.drawable.p1, 
			R.drawable.p2, 
			R.drawable.p3, 
			R.drawable.p4, 
			R.drawable.p5
			}; 

	public int getCount() {
		return mImageIds.length;
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView i = new ImageView(context); 
		i.setImageResource(mImageIds[position]);//set resource for the imageView 
		Gallery.LayoutParams lp = new Gallery.LayoutParams(
				ViewGroup.LayoutParams.WRAP_CONTENT,
				ViewGroup.LayoutParams.WRAP_CONTENT);
		lp.width = Constants.WIDTH/4;
		lp.height = Constants.HEIGHT/2;
		i.setLayoutParams(lp);//layout 
		return i; 
	}

}
